<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-model 双向绑定</title>
</head>
<body>
  
  <div id ="app">
   用户：<span><input type="text" v-model="username"></span>  <br/>
   密码：<span><input type="password" v-model="password"></span> <br/>
   <button @click="login">登陆</button> 
   <button @click="reset">重置</button>
  </div>
  <script src="/js/vue.js"></script> 
  <script>
    const app =new Vue({
      el:'#app',
      data:{
        username:'',
        password:'',
      },
      methods:{ 
        login(){
          this.username
          console.log('用户名为'+this.username);
          console.log('密码为'+this.password);
        },
        reset(){

        }
      }
    
    })
  </script>
</body>
</html>